<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <link rel="Bookmark" href="/favicon.ico" >
    <link rel="Shortcut Icon" href="/favicon.ico" />
    <!--[if lt IE 9]>
    <script type="text/javascript" src="/static/lib/html5shiv.js"></script>
    <script type="text/javascript" src="/static/lib/respond.min.js"></script>
    <![endif]-->
    <link rel="stylesheet" type="text/css" href="/static/h-ui/css/H-ui.min.css" />
    <link rel="stylesheet" type="text/css" href="/static/h-ui.admin/css/H-ui.admin.css" />
    <link rel="stylesheet" type="text/css" href="/static/lib/Hui-iconfont/1.0.8/iconfont.css" />
    <link rel="stylesheet" type="text/css" href="/static/h-ui.admin/skin/default/skin.css" id="skin" />
    <link rel="stylesheet" type="text/css" href="/static/h-ui.admin/css/style.css" />
    <!--[if IE 6]>
    <script type="text/javascript" src="lib/DD_belatedPNG_0.0.8a-min.js" ></script>
    <script>DD_belatedPNG.fix('*');</script>
    <![endif]-->
    <title>角色列表</title>
</head>
<body>

<div class="page-container">

<div class="panel panel-default">
    <div class="panel-header">管理员<a class="btn btn-success radius r" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></div>
    <div class="panel-body">
        
    <div class="text-l">
        <form action="" method="get">
            <input type="text" class="input-text" style="width:180px" placeholder="账号" value="{$Think.get.username}" name="username">
            <button type="submit" class="btn btn-success" name=""><i class="Hui-iconfont">&#xe665;</i> 查询</button>
        </form>
    </div>
    <div class="cl pd-5 bg-1 bk-gray mt-20"> <span class="l">
        <a href="{:url('admin/user/add')}"  class="btn btn-primary radius"><i class="Hui-iconfont Hui-iconfont-add2"></i> 添加</a></span> <span class="r">共有数据：<strong>{$total}</strong> 条</span>
    </div>
    <table class="table table-border table-bordered table-bg">
        <thead>
        <tr class="text-c">
            <th width="20">ID</th>
            <th width="30">账号</th>
            <th width="30">角色</th>
            <th width="30">姓名</th>
            <th width="30">手机</th>
            <th width="50">邮箱</th>
            <th width="10">状态</th>
            <th width="130">创建时间</th>
            <th width="120">更新时间</th>
            <th width="150">操作</th>
        </tr>
        </thead>
        <tbody>

        {volist name='list' id='item'}
        <tr class="text-c">
            <td>{$item.admin_id}</td>
            <td>{$item.username}</td>
            <td>{$item.role_name}</td>
            <td>{$item.realname}</td>
            <td>{$item.mobile}</td>
            <td>{$item.email}</td>
            <td>
                {if condition="$item.status eq 1"}
                <i class="Hui-iconfont c-success" title="正常">&#xe615;</i>
                {else /}
                <i class="Hui-iconfont c-danger" title="已禁用">&#xe631;</i>
                {/if}
            </td>
            <td>{:date('Y/m/d H:i:s',$item['create_time'])}</td>
            <td>{:date('Y/m/d H:i:s',$item['update_time'])}</td>
            <td class="td-manage">

                {if condition="$item.role_id neq 1"}
                    {if condition="$item.status eq 1"}
                    <a title="禁用" href="javascript:;" onclick="setStatus(this,'{:url(\'/admin/user/setStatus\')}'+'?admin_id={$item.admin_id}&status=0')" class="ml-5"><i class="Hui-iconfont c-danger">&#xe631;</i>禁用</a>
                    {else /}
                    <a title="启用" href="javascript:;" onclick="setStatus(this,'{:url(\'/admin/user/setStatus\')}'+'?admin_id={$item.admin_id}&status=1')" class="ml-5"><i class="Hui-iconfont c-success">&#xe615;</i>启用</a>
                    {/if}

                    <a title="编辑" href="{:url('admin/user/edit')}?admin_id={$item.admin_id}" class="ml-5"><i class="Hui-iconfont Hui-iconfont-edit2"></i>编辑</a>
                    <a title="删除" href="javascript:;" onclick="adminDel(this,'{:url(\'/admin/user/del\')}'+'?admin_id={$item.admin_id}')" class="ml-5 c-danger"><i class="Hui-iconfont Hui-iconfont-del2"></i>删除</a>
                {/if}
            </td>
        </tr>
        {/volist}

        </tbody>
    </table>

    <div class="cl pd-5 mt-20">
        <div class="l"></div>
        <div class="r">
            {$list|raw}
        </div>
    </div>

    </div>
</div>

</div>
<!--_footer 作为公共模版分离出去-->
<script type="text/javascript" src="/static/lib/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="/static/lib/layer/2.4/layer.js"></script>
<script type="text/javascript" src="/static/h-ui/js/H-ui.min.js"></script>
<script type="text/javascript" src="/static/h-ui.admin/js/H-ui.admin.js"></script> <!--/_footer 作为公共模版分离出去-->

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="/static/lib/laypage/1.2/laypage.js"></script>
<script type="text/javascript">

    /*管理员-删除*/
    function adminDel(obj, uri){
        layer.confirm('确认要删除吗？',function(index){
            $.ajax({
                type: 'GET',
                url: uri,
                dataType: 'json',
                success: function(data){
                    if(data.err==0) {
                        $(obj).parents("tr").remove();
                        layer.msg(data.msg, {icon: 1, time: 2000});
                        return true;
                    } else {
                        layer.msg(data.msg, {icon: 2, time: 3000});
                        return false;
                    }
                },
                error:function(data) {
                    console.log(data.msg);
                },
            });
        });
    }
    // 启用禁用管理员
    function setStatus(obj, uri){
        layer.confirm('确认要设置该账号么？',function(index){
            $.ajax({
                type: 'GET',
                url: uri,
                dataType: 'json',
                success: function(data){
                    if(data.err==0) {
                        layer.msg(data.msg, {icon: 1, time: 2000});
                        return true;
                    } else {
                        layer.msg(data.msg, {icon: 2, time: 3000});
                        return false;
                    }
                },
                error:function(data) {
                    console.log(data.msg);
                },
            });
        });
    }

</script>
</body>
</html>